﻿using System;
using System.Web.UI;
using SARS.Entity;

namespace SARS.Course
{
    public partial class AssignStudentCourse : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Roles"] == null || RoleType.Coordinator != (RoleType)Session["Roles"])
            {
                Response.Write("<script language='javascript'>window.alert('Your role is not allow to access this page.');" +
                               "window.location='../Account/Login.aspx';</script>");

            }
        }

        protected void btnAssign_Click(object sender, EventArgs e)
        {
            if (UcProgramCourse1.SelectedProgramValue > 0 && UcProgramCourse1.SelectedCourseValue > 0)
            {
                Response.Redirect(string.Format("ViewStudentCourse.aspx?pid={0}&cid={1}",
                    UcProgramCourse1.SelectedProgramValue,
                    UcProgramCourse1.SelectedCourseValue));
            }
            else
            {
                Response.Write("<script>alert('Please select Program and Course!')</script>");
            }
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Default.aspx");
        }
    }
}